/*
 * 8. Write a program that prints all the sequences
 * of 5 Latin capital letters that are palindromes.
 * Examples: ABCBA, XXYXX, AXAXA.
 */

public class Main {
    public static void main (String[] args) {
	for (char a = 'A'; a <= 'Z'; a++)
	    for (char b = 'A'; b <= 'Z'; b++)
		for (char c = 'A'; c <= 'Z'; c++)
		    System.out.printf("%1$c%2$c%3$c%2$c%1$c ", a, b, c);
	System.out.println();
    }
}
